package com.dynamic.mybatis.core.metadata;

import com.dynamic.mybatis.core.enums.TypeAlias;

import java.io.Serializable;
import java.sql.JDBCType;

/**
 * @Description
 * @Author xs
 * @Date 2022/11/17 11:04
 */
public class MappedStatementField implements Serializable {
    protected String dataBase;
    protected String schema;
    protected String tableName;
    protected String column;//
    protected String field; //转换后字段
    protected String name;
    protected String mergeType;// type 和 genericType 合并后的类型
    protected String type;//api接口文档类型
    protected String javaType;//类型
    protected Class javaTypeClass;//java类型
    protected String genericType;//泛型
    protected JDBCType jdbcType;//jdbc类型

    protected boolean primaryKey;//是否为主键
    protected boolean autoincrement;//自增
    protected boolean visible = true;
    protected Byte sort;
    protected String remarks;
    protected Object defaultValue;
    protected MappedStatementFieldValidator validator;

    public String getDataBase() {
        return dataBase;
    }

    public void setDataBase(String dataBase) {
        this.dataBase = dataBase;
    }

    public String getSchema() {
        return schema;
    }

    public void setSchema(String schema) {
        this.schema = schema;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getColumn() {
        return column;
    }

    public void setColumn(String column) {
        this.column = column;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getJavaType() {
        return javaType;
    }

    public void setJavaType(String javaType) {
        this.javaType = javaType;
    }

    public String getGenericType() {
        return genericType;
    }

    public void setGenericType(String genericType) {
        this.genericType = genericType;
    }

    public JDBCType getJdbcType() {
        return jdbcType;
    }

    public void setJdbcType(JDBCType jdbcType) {
        this.jdbcType = jdbcType;
    }

    public Class getJavaTypeClass() {
        return javaTypeClass;
    }

    public void setJavaTypeClass(Class javaTypeClass) {
        this.javaTypeClass = javaTypeClass;
    }

    public void setJavaTypeClass(String javaTypeClass) {
        this.javaTypeClass = TypeAlias.getType(javaTypeClass);
    }

    public boolean isPrimaryKey() {
        return primaryKey;
    }

    public void setPrimaryKey(boolean primaryKey) {
        this.primaryKey = primaryKey;
    }

    public boolean isAutoincrement() {
        return autoincrement;
    }

    public void setAutoincrement(boolean autoincrement) {
        this.autoincrement = autoincrement;
    }

    public Byte getSort() {
        return sort;
    }

    public void setSort(Byte sort) {
        this.sort = sort;
    }

    public MappedStatementFieldValidator getValidator() {
        return validator;
    }

    public void setValidator(MappedStatementFieldValidator validator) {
        this.validator = validator;
    }

    public String getMergeType() {
        return mergeType;
    }

    public void setMergeType(String mergeType) {
        this.mergeType = mergeType;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public boolean isVisible() {
        return visible;
    }

    public void setVisible(boolean visible) {
        this.visible = visible;
    }

    public Object getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(Object defaultValue) {
        this.defaultValue = defaultValue;
    }
}